<template>
    <div class="icons">
      <swiper>
        <swiper-slide>
          <div class="icon" v-for="item of iconsList" :key="item.id">
            <router-link :to="item.page">
              <div class="icon-img">
                <img class="icon-img-content" :src="item.imgUrl" />
              </div>
              <p class="icon-desc">{{item.desc}}</p>
            </router-link>
          </div>
        </swiper-slide>
      </swiper>
    </div>
</template>

<script>
export default {
  name: 'HomeIcons',
  data () {
    return {
      iconsList: [{
        id: '1',
        imgUrl: require('@/assets/icons/日程.png'),
        desc: '日程管理',
        page: '/Schedule/Center'
      }, {
        id: '2',
        imgUrl: require('@/assets/icons/图片.png'),
        desc: '图片管理',
        page: '/Picture'
      }, {
        id: '3',
        imgUrl: require('@/assets/icons/日记本.png'),
        desc: '日记本',
        page: '/Diary/Center'
      }, {
        id: '4',
        imgUrl: require('@/assets/icons/联系簿.png'),
        desc: '联系人',
        page: '/Contacts/Center'
      }, {
        id: '5',
        imgUrl: require('@/assets/icons/记账.png'),
        desc: '个人记账',
        page: '/Budget/Center'
      }
      ]
    }
  }
}
</script>

<style lang="stylus" scoped>
  .icons >>> .swiper-container
      height: 0
      padding-bottom: 50%
  .icon
    position: relative
    overflow: hidden
    height: 0
    float: left
    width: 25%
    padding-bottom: 25%
    .icon-img
      position: absolut
      top: 0
      left: 0
      right: 0
      bottom: .44rem
      box-sizing: border-box
      padding: .1rem
      .icon-img-content
        display: block
        height: 100%
        margin: 0 auto
    .icon-desc
      position: absolute
      left: 0
      right: 0
      bottom: 0
      height: .44rem
      line-height: .44rem
      text-align: center
</style>
